<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>双向绑定下拉列表</title>
</head>
<body>
<div id="app">
    <form>
        <select name="fruit" id="fruit" v-model="fruit">
            <!--          <option value=""></option>-->
            <option value="苹果">苹果</option>
            <option value="香蕉">香蕉</option>
            <option value="橙子">橙子</option>
            <option value="芒果">芒果</option>
        </select>

        <h2>你当前选中的水果是：{{ fruit }}</h2>
    </form>

    <form>
        <select name="fruits" id="fruits" v-model="fruits" multiple>
            <!--          <option value=""></option>-->
            <option value="苹果">苹果</option>
            <option value="香蕉">香蕉</option>
            <option value="橙子">橙子</option>
            <option value="芒果">芒果</option>
        </select>

        <h2>你当前选中的水果是：{{ fruits }}</h2>
    </form>
</div>
<script type="module">
    import {createApp, ref} from "../../../../../js/vue.esm-browser.js";

    const app = createApp({
            setup() {
                let fruit = ref(null)
                let fruits = ref([])
                return {
                    fruit,
                    fruits
                }
            }
        }
    )

    app.mount("#app")
</script>
</body>
</html>